<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>

</body>
<script>
    // es5 构造函数继承写法
    function Phone(name, brand, price) {
        this.name = name;
        this.brand = brand;
        this.price = price;
    }
    Phone.prototype.call = function () {
        console.log("使用手机打电话");
    }
    // 智能手机
    function SmartPhone(name, brand, price, os) {
        // 继承父类的属性
        Phone.call(this, name, brand, price);
        this.os = os;
    }
    // 设置子集构造函数的原型
    SmartPhone.prototype = new Phone();
    SmartPhone.prototype.constructor = SmartPhone;
    SmartPhone.prototype.photo = function () {
        return "拍照";
    }
    let Huawei = new SmartPhone("华为", "华为", 5999, "android");

    console.log(Huawei, Huawei.photo());



</script>

</html>